package com.dream.rpc.serializer;

import com.dream.rpc.spi.SpiLoader;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Dreamer
 */
public class SerializerFactory {


    static {
        SpiLoader.load(Serializer.class);
    }

//    public static final Map<String,Serializer> KEY_SERIALIZER_MAP = new HashMap<String,Serializer>(){
//        {
//            put(SerializerKeys.JDK, new JdkSerializer());
//            put(SerializerKeys.JSON, new JsonSerializer());
//            put(SerializerKeys.HESSIAN, new HessianSerializer());
//            put(SerializerKeys.KRYO, new KryoSerializer());
//        }
//    };


    public static final Serializer DEFAULT_SERIALIZER = new JdkSerializer();

    public static Serializer getInstance(String key) {
        return SpiLoader.getInstance(Serializer.class, key);
    }




}
